<template>
  <div class="app-container">
    <el-form ref="form" :model="form" label-width="150px">
      <el-form-item label="运营商">
        <el-select style="width: 300px" v-model="form.operator" placeholder="请选择">
          <el-option
            v-for="(item, index) in $store.getters.config.enum.operator"
            :key="index"
            :label="item.value"
            :value="item.id"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="套餐名字">
        <el-input v-model="form.name" style="width: 500px" class="filter-item" />
      </el-form-item>
      <el-form-item label="套餐价格(元)">
        <el-input v-model="form.price" style="width: 500px" class="filter-item" />
      </el-form-item>
      <el-form-item label="语音(分)">
        <el-input v-model="form.voice" style="width: 500px" class="filter-item" />
      </el-form-item>
      <el-form-item label="流量(MB)">
        <el-input v-model="form.flow" style="width: 500px" class="filter-item" />
      </el-form-item>
      <el-form-item label="套餐编码">
        <el-input v-model="form.operator_package_id" style="width: 500px" class="filter-item" />
      </el-form-item>

      <el-form-item>
        <el-button type="primary" @click="submit">保存</el-button>
        <el-button @click="$router.go(-1)">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { postSave } from '@/api/package';
export default {
  data() {
    return {
      form: {},
    };
  },
  created() {},
  methods: {
    async submit() {
      await postSave({ form: this.form });

      this.$message({
        message: '操作成功！',
        type: 'success',
      });
      setTimeout(() => this.$router.push('/meal/package'), 500);
    },
  },
};
</script>

<style lang="scss" scoped>
.app-container {
  padding: 40px 5%;

  .line {
    text-align: center;
  }
}
</style>
